#!/bin/bash

RESOURCE_VERSION=0.0.1
#输出路径
RESOURCE_PATH=`dirname "$PRG"`
#TAR包名称
RESOURCE_RELEASE_TAR=resa-$RESOURCE_VERSION.tar.gz

[ -z "$BUILD_HOME" ] && BUILD_HOME=`cd "$RESOURCE_PATH" ; pwd`
echo BUILD_HOME:[$BUILD_HOME]
echo RESOURCE_RELEASE_TAR:[$RESOURCE_RELEASE_TAR]

echo "开始构建"
#MAVEN编译
# 执行编译程序，失败则停止退出
set -e
mvn clean install -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Denforcer.skip=true -U || exit 1


# 打包TongIS 参数为 -PpackTongIS
mvn package assembly:single -Dmaven.test.skip=true -Dmaven.javadoc.skip=true || exit 1

#将压缩包修改名称移出
mv $BUILD_HOME/target/resa-*.tar.gz $BUILD_HOME/$RESOURCE_RELEASE_TAR

echo "完成包生成"
echo -e "\033[34m 包的位置: \033[0m""\033[32m "$BUILD_HOME/$RESOURCE_RELEASE_TAR" \033[0m"
